package com.leetcode.array_matrix;

/**
 * @author Dennis Li
 * @date 2020/7/21 14:26
 */
public class FindMaxConsecutiveOnes_485 {

    public int findMaxConsecutiveOnes(int[] nums) {
        if (nums.length == 0) return 0;
        int max = 0, cur = 0;
        for (int num : nums) {
            cur = num == 1 ? cur + 1 : 0;
            max = Math.max(max, cur);
        }
        return max;
    }

}
